<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <input type="text" id="name">
    <button id="btn">这是啥？名？</button>
    <input type="text" id="pass">
    <button id="btn1">交？有种你交！码呢？</button>
    <input type="text" id="email">
    <button id="btn2">卧槽？？邮啊？</button>
    <input type="text" name="" id="qq">
    <button id="btn3">啊！ass we can！抠抠号</button>
    <input type="text" id="phone">
    <button id="btn5">啊？乖乖站好！加个V</button>
    <button id="btn6">好了？</button>
    <script>
        var btn = document.getElementById("btn")
        var btn1 = document.getElementById("btn1")
        var btn2 = document.getElementById("btn2")
        var btn3 = document.getElementById("btn3")
        var btn5 = document.getElementById("btn5")
        var btn6 = document.getElementById("btn6")
        var inputname = document.getElementById("name")
        var inputpass = document.getElementById("pass")
        var inputemail = document.getElementById("email")
        var inputqq = document.getElementById("qq")
        var inputphone = document.getElementById("phone")
        //名字
        var num;
        var num1;
        var num2;
        var num3;
        var num4;
        var arg1 = /[\u4e00-\u9fa5]{2,4}/
        btn.onclick = function () {
            var input = inputname.value
            if (arg1.test(input)) {
                num = true
                console.log("好的呢")
                btn.style.background = "#7bab2e"
            } else {
                num = false
                console.log("废物？")
            }
        }
        //qq号邮箱
        var arg2 = /^[1-9][0-9]{3,9}[0-9]$/
        btn3.onclick = function () {
            var input = inputqq.value
            if (arg2.test(input)) {
                num1 = true
                console.log("好的呢")
                btn3.style.background = "#7bab2e"
            } else {
                num1 = false
                console.log("废物？")
            }
        }
        var arg3 = /^\w+@[a-zA-Z0-9]{2,}\.[a-z]{2,4}\.[a-z]{2,4}|^\w+@[a-zA-Z0-9]{2,}\.[a-z]{2,4}/
        btn2.onclick = function () {
            var input = inputemail.value
            if (arg3.test(input)) {
                num2 = true
                console.log("好的呢")
                btn2.style.background = "#7bab2e"
            } else {
                num2 = false
                console.log("废物？")
            }
        }
        //手机号
        var arg4 = /^1\d{4,10}$/
        btn5.onclick = function () {
            var input = inputphone.value
            if (arg4.test(input)) {
                num3 = true
                console.log("好的呢")
                btn5.style.background = "#7bab2e"
            } else {
                num3 = false
                console.log("废物？")
            }
        }
        //密码
        var reg = /[0-9]{8,}/
        var reg1 = /[0-9a-z]{8,}/
        var reg2 = /[0-9a-zA-Z_]{8,}/
        var reg3 = /[A-Z]/
        var reg4 = /[a-z]/
        var reg5 = /[a-z]{8,}/
        var reg6 = /[0-9]/
        btn1.onclick = function () {
            var input = inputpass.value
            if ((reg.test(input) && reg4.test(input) == false) || (reg6.test(input) == false && reg5.test(input))) {
                console.log("oh yes!")
                btn1.style.background = "#7bab2e"
                num4 = true
            } else if (reg.test(input) && reg4.test(input) || reg1.test(input) && reg3.test(input) == false) {
                num4 = true
                console.log("oh yesyes!")
                btn1.style.background = "yellow"
            }
            else if (reg2.test(input)) {
                console.log("oh yesyesyesyes!")
                num4 = true
                btn1.style.background = "red"
            }
            else {
                console.log("holy shit!")
                num4 = false
            }
        }
        btn6.onclick = function (e) {
            e.previousDefault()
            if (num && num1 && num2 && num3 && num4) {
                console.log("just do it!!!!!")
                btn6.style.background = "#7bab2e"
                alert("交好了赶紧爬")
            } else {
                console.log("你搁这儿交啥呢")
            }
        }
    </script>
</body>

</html>